//
//
//
//
//
//
// Queue.h

#ifndef _QUEUE_H_
#define _QUEUE_H_

#include "common.h"
#include "datatypes.h"

#include "Mutex.h"
#include <list>

class BaseQueueMsg;
class Queue
{
	public:
		Queue(U32 max = 8192 /* 8K msgs*/);
		~Queue(void);

		// get msg from front
		BaseQueueMsg* Front();
		U32 Front(BaseQueueMsg* msg);

		// get msg from back
		BaseQueueMsg* Back();
		U32 Back(BaseQueueMsg* msg);

		// enqueue with priority
		U32 Enqueue(BaseQueueMsg* msg);

		U32 Size();
	private:
		std::list<BaseQueueMsg*> _msgList;
		Mutex _mutex;

		U32 _max;
};

#endif //_QUEUE_H_
